from Episode import Episode

class EpisodeUtil(object):
            
    def createFromMatch(self, match):
        episodeNumber = match.group(3)
        extraEpisodeNumber =  match.group(4)
        container = match.group(5)
        return Episode(Episode.DEFAULT_EPS_NAME, episodeNumber, container, extraEpisodeNumber)
    
    
    def loadFromXml(self, episode, xml):
        episode.setTitle(xml.findtext("EpisodeName"))
        episode.setRating(xml.findtext("Rating"))
        episode.setDirector(xml.findtext("Director"))
        episode.setPlot(xml.findtext("Overview"))
        episode.setAired(xml.findtext("FirstAired"))
        return episode
        
                